//
//  Tool_configuration.swift
//  StoreManage
//
//  Created by MC on 2018/4/24.
//  Copyright © 2018年 MC. All rights reserved.
//

import Foundation


// 接口的处理
public func MCGetInterfaceInfo() -> NSMutableDictionary {
    let plistPath = Bundle.main.path(forResource: "Interface", ofType: "plist")
    let dictM : NSMutableDictionary = NSMutableDictionary.init(contentsOfFile: plistPath!)!
    return dictM
}
public func MCGetInterface_isProduct() -> Bool {
    let dictM = MCGetInterfaceInfo()
    let isProduct = dictM["isProduct"] as? NSNumber ?? 1
    return isProduct.boolValue
}
public func MCGetInterface_javaWithType(type:String) -> String {
    let dictM = MCGetInterfaceInfo()
    let isProduct = MCGetInterface_isProduct()
    let debug   = dictM["debug_java"] as? String ?? ""
    let release = dictM["release_java"] as? String ?? ""
    if isProduct {
        return release + type + "/"
    } else {
        return debug + type + "/"
    }
}

public func MCGetInterface_h5() -> String {
    let dictM = MCGetInterfaceInfo()
    let isProduct = MCGetInterface_isProduct()
    let debug   = dictM["debug_h5"] as? String ?? ""
    let release = dictM["release_h5"] as? String ?? ""
    if isProduct {
        return release + "/"
    } else {
        return debug + "/"
    }
}

// 获取微信key
public func MCGetConfiguration_wxKey() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["MCKey_wx"] as? String ?? ""
    return key
}
// 获取极光key
public func MCGetConfiguration_JpushKey() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["MCKey_Jpush"] as? String ?? ""
    return key
}
// 获取appId
public func MCGetConfiguration_appId() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["appId"] as? String ?? ""
    return key
}

// 获取身份名称
public func MCGetConfiguration_managerName() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["MCRole_manager_name"] as? String ?? ""
    return key
}

public func MCGetConfiguration_assistantName() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["MCRole_assistant_name"] as? String ?? ""
    return key
}

public func MCGetConfiguration_salesStaff() -> String {
    let dictM = MCGetInterfaceInfo()
    let key   = dictM["MCRole_salesStaff_name"] as? String ?? ""
    return key
}
